﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Prowess.OIS.DicomImpExp.View.Interface;
using Prowess.OIS.DicomImpExp.Model.Interface;
using Prowess.OIS.DicomImpExp.Presenter.Interface;
using Microsoft.Win32;
using Prowess.OIS.DicomImpExp.PresenterFactory;

namespace Prowess.OIS.DicomImpExp.View
{
    /// <summary>
    /// Interaction logic for WndDicomImport.xaml
    /// </summary>
    public partial class WndDicomImport : Window,IDicomImportView
    {
        public WndDicomImport()
        {
            InitializeComponent();
        }

#region Private Member
        private String folderDirectory;
        private IPatientInfo formModel;
        private IDicomImportPresenter presenter;
#endregion
#region Public member
        public string FolderDirectory
        {
            get
            {
                return tbxDirectory.Text;
            }
            set
            {
                tbxDirectory.Text = value;
            }
        }

        public IPatientInfo FormModel
        {            
            set
            {
                //Binding to treeview

            }
        }
#endregion

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //presenter = DicomImportPresenterFactory.GetDicomImportPresenter();
            presenter.DicomImportView = this;
        }

        private void btnBrowse_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openfile = new OpenFileDialog();
            openfile.Filter = "Dicom File|*.dcm|All File| *.*";
            openfile.Multiselect = false;
            if (openfile.ShowDialog()==true)
            {
                FolderDirectory = openfile.FileName;
                //if (presenter!=null)
                //{
                //    //Parse dicom to get value from dicom file
                //    presenter.DicomParse();
                //}
                //XmlGenerate xml = new XmlGenerate();
            }
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void btnImport_Click(object sender, RoutedEventArgs e)
        {
            if (presenter!=null)
            {
                presenter.Import();
            }
        }
        
    }
}
